<template>
  <div class="allComment">
    <div class="commentItem">
      <div class="userInfo">
        <div class="avatar" :style="{backgroundImage:`url(${comments.avatar})`}"></div>
        <div class="userOther">
          <div class="userName">{{comments.nickname}}</div>
          <div class="commonTime">{{comments.ctime}}</div>
        </div>
      </div>
      <div class="selfComment">{{comments.content}}</div>
      <div class="otherComment" v-if="comments.to_user">
        <div class="otherName">@{{comments.to_user}}:</div>
        <div class="otherCotent">{{comments.to_user_info.fcontent}}</div>
      </div>
    </div>
  </div>
</template>

<script>
  import { mapGetters, mapActions } from 'Vuex'
  import { formatD } from '../../plugins/utils'

  export default {
    data() {
      return {}
    },
    props: ['comment'],
    computed: {
      // ...mapGetters([
      //   'isShowComment'
      // ])
      comments() {
        const comments = this.comment
        if (comments.ctime) {
          comments.ctime = formatD(comments.ctime)
        }

        return comments
      }
    },
    mounted() {
      // console.log(this.comment)
    },
    methods: {
      // ...mapActions({
      //   _handleAdd: 'ADDCOUNT',
      //   _handleSub: 'SUBCOUNT'
      // })
    }

  }
</script>
<style scoped lang="scss">
  div {
    width: auto;
    height: auto;
  }

  .allComment {
    width: 100%;
  }

  .commentItem {
    width: 100%;
    padding: 32px;
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid rgba(0, 0, 0, .1);

    .userInfo {
      min-width: 100px;
      height: 64px;
      display: flex;

      .avatar {
        width: 64px;
        height: 64px;
        border-radius: 100%;
        background: url("") no-repeat center;
        -webkit-background-size: cover;
        background-size: cover;
        margin-right: 16px;
      }

      .userOther {
        width: auto;
        display: flex;
        flex-direction: column;
        justify-content: space-between;

        .userName {
          font-size: 30px;
          line-height: 30px;
          color: #4B4B4B;
          font-weight: 500;
        }

        .commonTime {
          font-size: 22px;
          color: #b2b8bf;
        }
      }

    }

    .selfComment {
      margin: 24px 0;
      font-size: 28px;
    }

    .otherComment {
      width: 622px;
      background: #F5F8FA;
      border-radius: 8px;
      padding: 16px;

      .otherName {
        font-size: 26px;
      }

      .otherCotent {
        font-size: 28px;
      }

    }
  }

</style>
